<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tjsinfo.tjsoa.common.TestRiQi"%>
<%@page import="com.tjsinfo.tjsoa.common.DateTimeFromConver"%>
<%@page import="com.tjsinfo.tjsoa.worklog.vo.WorkLogMain"%>
<%@page import="com.tjsinfo.tjsoa.system.vo.User"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<base href="<%=basePath%>"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>粮油集团办公自动化协作平台</title>
<link rel="stylesheet" type="text/css" href="<%=basePath %>ajaxFramework/ext-2.1/resources/css/ext-all.css" />
<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
<link href="<%=basePath %>style/txlz7.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" >
	function tdchick(time)
	{
		document.getElementById('black_over').style.display = "block";
		document.getElementById('addfrom').style.top =  document.body.clientHeight/2;
		document.getElementById('addfrom').style.left = document.body.clientWidth/5;
		document.getElementById('addfrom').style.display = "block";
		document.getElementById('xiugai').style.display = "none" ;
		document.getElementById('shanchu').style.display = "none" ;
		// document.getElementById('wcqk').style.display = "none" ;
		document.getElementById('chaxun').style.display = "none" ;
		document.getElementById('tianja').style.display = "inline" ;
		document.getElementById('time').value=time;
		
		
	}
	function tdchick2(time,id)
	{
	
		document.getElementById('black_over').style.display = "block";
		document.getElementById('addfrom').style.top =  document.body.clientHeight/2;
		
		document.getElementById('addfrom').style.left = document.body.clientWidth/5;
		document.getElementById('addfrom').style.display = "block";
		document.getElementById('tianja').style.display = "none" ;
		
		document.getElementById('worklogid').value  = id;
		document.getElementById('time').value=time;
		
	}
	function tdchick3(time,id)
	{
		document.getElementById('black_over').style.display = "block";
		document.getElementById('addfrom').style.top =  document.body.clientHeight/2;
		document.getElementById('addfrom').style.left = document.body.clientWidth/5;
		document.getElementById('time').value=time;
		document.getElementById('worklogid').value  = id;
		document.getElementById('addfrom').style.display = "block";
		document.getElementById('tianja').style.display = "none" ;
		document.getElementById('shanchu').style.display = "none" ;
		document.getElementById('xiugai').style.display = "none" ;
		
	}
	function addWorkLog()
	{
		document.form1.submit();
	}
			
	
	function deleteWorkLog()
	{
		
			
		var form1 =  document.getElementById('form1');
	form1.setAttribute('action','<%=basePath%>tjsinfo/tjsoa/worklog/deleteWorkLog.do');
		document.form1.submit();
	}
	function deletefrom()
	{
		qx();
		document.getElementById('black_over').style.display = "block";
			document.getElementById('deletefrom').style.top =  document.body.clientHeight/2;
		document.getElementById('deletefrom').style.left = document.body.clientWidth/5;
		document.getElementById('deletefrom').style.display = "block";
		
	}
	function updateWorkLog()
	{
	
		var form1 =  document.getElementById('form1');
		form1.setAttribute('action','<%=basePath%>tjsinfo/tjsoa/worklog/selectOneWorkLog.do');
		document.form1.submit();
	}
	function chaxunWorkLog()
	{
		var form1 =  document.getElementById('form1');
		form1.setAttribute('action','<%=basePath%>tjsinfo/tjsoa/worklog/selectWorkLog.do');
		document.form1.submit();
	}
	function wanchengWorkLog()
	{
		alert('ddd');
		var form1 =  document.getElementById('form1');
		form1.setAttribute('action','<%=basePath%>tjsinfo/tjsoa/worklog/addWorkLogSituationFrom.do');
		document.form1.submit();
	}
	function qx()
	{
		document.getElementById('black_over').style.display = "none";
		document.getElementById('addfrom').style.display = "none";
		document.getElementById('xiugai').style.display = "inline" ;
		document.getElementById('shanchu').style.display = "inline" ;
		// document.getElementById('wcqk').style.display = "inline" ;
		document.getElementById('chaxun').style.display = "inline" ;
		document.getElementById('tianja').style.display = "inline" ;
		
	}
	function qxdeletefrom()
	{
		document.getElementById('black_over').style.display = "none";
		document.getElementById('deletefrom').style.display = "none";
	}
		function selectfrom()
	{
		document.getElementById('selectfrom').style.display = "block";
		document.getElementById('black_over').style.display = "block";
		document.getElementById('selectfrom').style.top =  document.body.clientHeight/2;
		document.getElementById('selectfrom').style.left = document.body.clientWidth/5;
		
	}
	function qxselectfrom()
	{
		document.getElementById('black_over').style.display = "none";
		document.getElementById('selectfrom').style.display = "none";
	}
	function select()
	{
		var keyword = document.getElementById('keyword');
		if(keyword.value == '')
		{
			alert('请输入关键字');
			return;
		}
		document.slectform.submit();
	}
</script>
<style >
	.contact_content {
			display: none;
			position: absolute;
			border: 1px solid #FFF;
			border-bottom:none;
			z-index:1800;
			overflow: auto;
		}
		.black_overlays{
			display: none;
			position: absolute;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: #C1EBFC;
			z-index:1002;
			-moz-opacity: 0.8;
			opacity:.80;
			filter: alpha(opacity=30);
		}
	
</style>
<style>
#container {
		    width:600px;
		    height:300px;
		    border:3px solid #c3daf9;
		}
		
.calendar {
    background-image:url(<%=basePath%>images/icon_64.gif) !important;
}

.blist {
    background-image: url(<%=basePath%>images/icon_64.gif) !important;
}

.bmenu {
    background-image: url(<%=basePath%>images/ju.gif) !important;
}

.menu-title{
    background: #ebeadb url(<%=basePath%>images/icon_64.gif) repeat-x;
    border-bottom:1px solid #99bbe8;
    color:#15428b;
    font:bold 10px tahoma,arial,verdana,sans-serif;
    display:block;
    padding:3px;
}
.lan01{
background: url(images/lanbg01.gif) no-repeat 0 0; width:6px; height:24px;} 
.lan02{
background: url(images/lanbg02.gif) repeat-x; width:99%; height:24px;}            
.lan03{
background: url(images/lanbg03.gif) no-repeat; width:8px; height:24px;}             
.cha{
padding-top:3px}           
</style> 
</head>
<body>
<%
			Date date = (Date)request.getAttribute("yueli");
			Map map = (Map)request.getAttribute("worklogmap");
			int start = 0;
			session.setAttribute("type","D");
			String[] week = {"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
%>
<div id="right">
      <div  >
      	<div id="menu" style="margin: 0"></div>
	  </div>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="92%">
          <tr>
            <td width="100%" valign="top" height="100%">
               <div class="contabwd">
                 <div id="plan_month">
                   
                    <!--周记录-->
                    <div class="plan_div" >
                      <table width="100%" border="0" class="page">
                        <tr>
                          <td width="20%">&nbsp;</td>
                          <td width="10%"><a href="<%=basePath%>tjsinfo/tjsoa/worklog/workLogDateModleUp.do?date=<%=DateTimeFromConver.zhuanhuariqi(date) %>" class="a1">上一月</a></td>
                          <td width="3%">&nbsp;</td>
                          <td width="31%"><strong><%=TestRiQi.firstMonth(date)%> 至 <%=TestRiQi.lastMonth(date) %></strong></td>
                          <td width="17%"><a href="<%=basePath%>tjsinfo/tjsoa/worklog/workLogDateModleDown.do?date=<%=DateTimeFromConver.zhuanhuariqi(date) %>" class="a2">下一月</a></td>
                          <td width="16%">&nbsp;</td>
                        </tr>
                      </table>
                      <table border="0" cellspacing="0" class="tab_list">
                        <tr>
                          <th>星期日 </th>
                          <th>星期一</th>
                          <th>星期二</th>
                          <th>星期三</th>
                          <th>星期四</th>
                          <th>星期五</th>
                          <th>星期六</th>
                        </tr>
                        <tr>
        <%
     		date.setDate(1);
     		
     		for(int i =1,u=0;i!=u;i++)
     		{
     	
     			//if(i>max)
     			//{
     				//out.print(TestRiQi.monthlast(date));
     				//return;
     			//}
     		%>
				
				<%
					String riqistr = DateTimeFromConver.zhuanhuariqi(date);
					for(int a = 0;a<7&&start == 0;a++)
					{
						
							if(TestRiQi.jishuxingqi(riqistr).equals(week[a]))
							{
								start = 1;
								break;
							}
							else
							{
								i++;
					%>
						 <td class="color">&nbsp;</td>
					<% 			
							}
							
					}
					if(start == 1)
					{
						if(map.get(DateTimeFromConver.datetostr(riqistr)) == null)
						{
							
						
					%>
		  <td align="center" >
		  <h2><%=riqistr %></h2>
		  <a href="<%=basePath%>tjsinfo/tjsoa/worklog/addWorkLogFrom.do?time=<%=riqistr %>&year=<%=date.getYear()+1900 %>&type=D&number=0">
		  <img src="images/wu.gif" />	
		  </a>	
		  </td>
		<%
						}	
						else 
						{
							WorkLogMain workLogMain = (WorkLogMain)map.get(DateTimeFromConver.datetostr(riqistr));
							if(workLogMain.getStart() == 1)
							{	
		%>
		   <td class="yellow">
		  <h2><%=riqistr %></h2>
		  <a href="javascript:tdchick2('<%=riqistr%>','<%=workLogMain.getId()%>')">
		  <img src="images/yzd.gif" />
		  </a>	
		  </td>
		<% 					}
							else if(workLogMain.getStart() == 2)
							{
		%>
		  <td class="blue">
		  <h2><%=riqistr %></h2>
		  <a href="<%=basePath%>tjsinfo/tjsoa/worklog/selectWorkLog.do?time=<%=riqistr %>&year=<%=date.getYear()+1900 %>&type=D&number=0&id=<%=workLogMain.getId() %>">
		  <img src="images/ycy.gif" />
		  </a>	
		  </td>	
		<% 						
							}	
							else if(workLogMain.getStart() == 3)
							{
		%>	
		  <td class="green" onclick="tdchick4('<%=riqistr%>')">
		  <h2><%=riqistr %></h2>
		  <img src="images/ywc.gif" />	
		  </td>							
		<% 
							}
						}	
			}
					
		%>
       	
		<% 	
     		if(i%7==0)
     		{
     	     %>
			</tr>
			
			<% 	
     		}
     			int a = date.getMonth();
     			date = TestRiQi.afterNDay(date,1);
     			if(a != date.getMonth())
     			{
     				u = i + 1;
     			}
     		}
     	   %>
                      </table>
                    </div>
                </div>
              </div>
            </td>
          </tr>
      </table>
      
</div>
	<form action="<%=basePath%>tjsinfo/tjsoa/worklog/addWorkLogFrom.do" name="form1" method="post" id="form1">
		    <div style="display: none;" class="contact_content" id="addfrom">
             <table width="478" border="0" cellpadding="0" cellspacing="0" >
               <tr>
                 <td>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td class="lan01">&nbsp;</td>
                        <td class="lan02">
                          <table width="99%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="5%" align="center" style="padding-top:3px;"><img src="images/m_icon051.gif" /></td>
                                <td width="89%" align="left" style="color:#FFFFFF; font-weight:bold;padding-top:3px;">编辑</td>
                                <td width="6%"><div class="cha"><a href="javascript:qx()"><img src="images/cha.gif" /></a></div></td>
                              </tr>
                           </table>
                        </td>
                        <td class="lan03">&nbsp;</td>
                      </tr>
                  </table>
                 </td>
               </tr>
               <tr>
                 <td height="109" class="zz">
                     <table width="90%" height="80%" border="0" cellspacing="0" cellpadding="0" class="researchtab">
                      <tr>
                        <td width="17%" align="center"><img src="images/bjicon.jpg" /></td>
                        <td width="83%" align="left">如有需要请点击以下按钮</td>
                      </tr>
                      <tr>
                        <td align="center" colspan="2" style="border-top:1px #CFCFD1 solid"><a href="javascript:updateWorkLog()" ><img src="images/xiugai.gif" id="xiugai"/></a>&nbsp;<a href="javascript:deletefrom()" ><img src="images/shanchu.gif" id="shanchu"/></a>&nbsp;<a href="javascript:chaxunWorkLog()" ><img src="images/chaxun.gif" id="chaxun" /></a>&nbsp;<a href="javascript:addWorkLog()" ><img src="images/tianjia.gif" id="tianja"/></a>&nbsp;<a href="javascript:qx()" ><img src="images/qx.gif" id="qx"/></a>
                        </td>
                       </tr>
                    </table>
                 </td>
               </tr>
             </table>
            </div>
            
            
            
             <div style="display: none;" class="contact_content" id="deletefrom">
             <table width="478" border="0" cellpadding="0" cellspacing="0" >
               <tr>
                 <td>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td class="lan01">&nbsp;</td>
                        <td class="lan02">
                          <table width="99%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="5%" align="center" style="padding-top:3px;"><img src="images/m_icon051.gif" /></td>
                                <td width="89%" align="left" style="color:#FFFFFF; font-weight:bold;padding-top:3px;">编辑</td>
                                <td width="6%"><div class="cha"><a href="javascript:qxdeletefrom()"><img src="images/cha.gif" /></a></div></td>
                              </tr>
                           </table>
                        </td>
                        <td class="lan03">&nbsp;</td>
                      </tr>
                  </table>
                 </td>
               </tr>
               <tr>
                 <td height="109" class="zz">
                     <table width="90%" height="80%" border="0" cellspacing="0" cellpadding="0" class="researchtab">
                      <tr>
                        <td width="17%" align="center"><img src="images/bjicon.jpg" /></td>
                        <td width="83%" align="left">是否要删除您选择的日志,请确认?</td>
                      </tr>
                      <tr>
                        <td align="center" colspan="2" style="border-top:1px #CFCFD1 solid"><a href="javascript:deleteWorkLog()" ><img src="images/qd.gif" />&nbsp;<a href="javascript:qxdeletefrom()" ><img src="images/qx.gif" /></a>
                        </td>
                       </tr>
                    </table>
                 </td>
               </tr>
             </table>
            </div>  
		<input  type="hidden" name="type" value="<%="D"%>"/>
		<input  type="hidden" name="year" value="<%=date.getYear()+1900%>"/>
		<input  type="hidden" name="number" value="0"/>
		<input  type="hidden" name="time" value="" id="time"/>
		<input  type="hidden" name="id" value="" id="worklogid"/>
		
	</form>
	
	<form action="<%=basePath%>tjsinfo/tjsoa/worklog/workLogSelect.do" name="slectform" method="post">
   		 
   		 <div style="display: none;" id="selectfrom" class="contact_content">
             <table width="478" border="0" cellpadding="0" cellspacing="0" >
               <tr>
                 <td>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td class="lan01">&nbsp;</td>
                            <td class="lan02">
                              <table width="99%" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td width="5%" align="center" style="padding-top:3px;"><img src="images/jing.gif" /></td>
                                    <td width="89%" align="left" style="color:#FFFFFF; font-weight:bold;padding-top:3px;">查询</td>
                                    <td width="6%"><div class="cha"><a href="javascript:qxselectfrom()"><img src="images/cha.gif" /></a></div></td>
                                  </tr>
                               </table>
                            </td>
                            <td class="lan03">&nbsp;</td>
                          </tr>
                     </table>
                 </td>
               </tr>
               <tr>
                 <td height="150" class="zz">
                     <table width="90%" height="90%" border="0" cellspacing="0" cellpadding="0" class="researchtab" >
                      <tr>
                        <td width="18%">类型：</td>
                        <td align="left">
                        <select name="type" class="textinput" >
                        <option value="" >全部</option>
                        <option value="D" selected="selected">日报</option>
                        <option value="W">周报</option>
                        <option value="M">月报</option>
                        <option value="Q">季报</option>
                        <option value="H">半年报</option>
                        <option value="Y">年报</option>
                        </select></td>
                      </tr>
                      <tr>
                        <td>关键字：</td>
                        <td align="left"><input name="keyword" type="text" size="50"/></td>
                      </tr>
                      <tr>
                        <td colspan="2" style="border-top:1px #CFCFD1 solid" height="40"><a href="javascript:select()"><img src="images/chaxun.gif" /></a>
                        </td>
                       </tr>
                   </table>
                 </td>
               </tr>
             </table>
            </div>
   	</form>
   
                        <div class="black_overlays" style="display: none;" id="black_over"></div>
<script type=text/javascript>
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL="ajaxFramework/ext-2.1/resources/images/default/s.gif";
		var menu = new Ext.menu.Menu({
	        id: 'mainMenu',
	        items: [
	            {
	                text: '添加年报',
	                handler: function(){
						window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/addWorkLogYearFrom.do';
					}
	            },
	            {
	                text: '查看',
	                handler: function(){
						window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLogYearModle.do';
					}
	            }
	        ]
	    });
	    
		var menuList = new Ext.menu.Menu({
	        id: 'mainMenuList',
	        items: [
	            {
	                text: '日报',
	                handler: function(){
						window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLoglistmode.do?type=D';
					}
	            },
	            {
	                text: '周报',
	                handler: function(){
						window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLoglistmode.do?type=W';
					}
	            },
	            {
	                text: '月报',
	                handler: function(){
						window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLoglistmode.do?type=M';
					}
	            },
	            {
	                text: '季报',
	                handler: function(){
						window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLoglistmode.do?type=Q';
					}
	            },
	            {
	                text: '半年报',
	                handler: function(){
						window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLoglistmode.do?type=H';
					}
	            },
	            {
	                text: '年报',
	                handler: function(){
						window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLoglistmode.do?type=Y';
					}
	            }
	        ]
	    });
		var tb = new Ext.Toolbar(
			{
				height:25
			}
		);
	
	    tb.render('menu');
		tb.add({
	            text:'<font color="black">日报</font>',
	            iconCls: 'bmenu',
	        	handler: function(){
					window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLogDateModle.do';
				}
	        
	    },{
	            text:'<font color="black">周报</font>',
	            iconCls: 'bmenu',
	        	handler: function(){
					window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLogWeekModle.do';
				}
	        
	    },{
	            text:'<font color="black">月报</font>',
	            iconCls: 'bmenu',
	        	handler: function(){
					window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLogMonthModle.do';
				}
	        
	    },{
	            text:'<font color="black">季报</font>',
	            iconCls: 'bmenu',
	        	handler: function(){
					window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLogJiDuModle.do';
				}
	        
	    },{
	            text:'<font color="black">半年报</font>',
	            iconCls: 'bmenu',
	        	handler: function(){
					window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLogHalfYearModle.do';
				}
	        
	    },{
	            text:'<font color="black">年报</font>',
	            iconCls: 'bmenu',  // <-- icon
	            menu: menu  // assign menu by instance
	        
	    },{
	            text:'<font color="black">列表视图</font>',
	            iconCls: 'bmenu',  // <-- icon
	            menu: menuList  // assign menu by instance
	        
	    },
	    {
	            text:'<font color="black">设置默认审批人</font>',
	            iconCls: 'bmenu',
	        	handler: function(){
					window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/workLogSetDefineFrom.do';
				}
	    },
	    {
	            text:'<font color="black">查询</font>',
	            iconCls: 'bmenu',
	        	handler: function(){
					selectfrom();
				}
	    }<%
	    	User user =  (User)session.getAttribute("user");
	    	
	   %>,{
	            text:'<font color="black">查看他人工作日志</font>',
	            iconCls: 'bmenu',
	        	handler: function(){
					window.location.href='<%=basePath%>tjsinfo/tjsoa/worklog/checkDefalntWorkLog.do';
				}
	    }<% 		
	    	
	    %>);
		
	}
);
</script>                        
</body>
</html>

  
